<!DOCTYPE HTML>
<html>

	<head>
		<script src="${rc.contextPath}/js/allmobilize.min.js" charset="utf-8" id="allmobilize"></script>
		<meta content="no-siteapp" http-equiv="Cache-Control">
		<link media="handheld" rel="alternate">
		<!-- end 云适配 -->
		<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
		<title>添加公司-城建就业指导网</title>

		<script type="text/javascript">
			console.log(1);
		</script>
		<link href="${rc.contextPath}/css/style.css" type="text/css" rel="stylesheet">
		<link href="${rc.contextPath}/css/external.min.css" type="text/css" rel="stylesheet">
		<link href="${rc.contextPath}/css/popup.css" type="text/css" rel="stylesheet">
		<script type="text/javascript" src="${rc.contextPath}/js/jquery.1.10.1.min.js"></script>
		<script src="${rc.contextPath}/js/jquery.lib.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="${rc.contextPath}/js/ajaxfileupload.js"></script>
		<script src="${rc.contextPath}/js/additional-methods.js" type="text/javascript"></script>
		<!--[if lte IE 8]>
		    <script type="text/javascript" src="${rc.contextPath}/js/excanvas.js"></script>
		<![endif]-->
		<style type="text/css">
			select[class~=selectr]{
				appearance: none;
				-moz-appearance: none;
				-webkit-appearance: none;
			}
			
		</style>
	</head>

	<body>
		<div id="body">
			
			<!-- end #header -->
			<div id="container">

				<div class="content_mid">
					<dl class="c_section c_section_mid">
						<dt>
                    <h2><em></em>填写公司信息</h2>
                </dt>
						<dd>
							<form id="addcompanyForm">
								<div class="c_text_1">公司信息是求职者加速了解公司的窗口，认真填写吧！</div>


								<h3>公司全称</h3>
								<input type="text" placeholder="请输入公司全名称" value="" name="company.company_name" id="company.company_name" class="valid">

								<h3>公司LOGO（点击图片上传）</h3>
								<div class="c_logo c_logo_pos">
									<img width="190" height="190" class="img-thumbnail" name="show_company_logo" id="show_company_logo" width="50px" 
										src="${rc.contextPath}/img/logo_default.png"/>
									<input type="hidden" name="company.company_logo" id="company_logo" />
									<input type="file" class="form-control" id="company_logo_upload" 
										name="company_logo_upload" onchange="ajaxfileuploadCompanyLogo()">
									
								</div>

								<h3>公司网址</h3>
								<input type="text" placeholder="请输入公司网址" name="company.company_website" id="company.company_website">

								<h3>所在城市</h3>
								<input type="text" placeholder="请输入工作城市，如：北京" name="company.company_location" id="company.company_location">
								
								<h3>公司具体地址</h3>
								<input type="text" placeholder="请输入工作城市，如：北京" name="company.company_address" id="company.company_address">

								<h3>行业领域</h3>
								<div>
									<select class="selectr selectr_380" name="company.company_domain" id="company.company_domain">
										#foreach($!domain in $!domainList)
										<option value="$!domain.id"><span>$!domain.domain_name</span></option>
										#end
									</select>
								</div>

								<h3>公司规模</h3>
								<div>
									<select class="selectr selectr_380" name="company.company_scale" id="company.company_scale">
										<option value="0"><span>少于15人</span></option>
										<option value="1"><span>15-50人</span></option>
										<option value="2"><span>50-150人</span></option>
										<option value="3"><span>150-500人</span></option>
										<option value="4"><span>500-2000人</span></option>
										<option value="5"><span>2000人以上</span></option>
									</select>
									
								</div>

								<h3>发展阶段</h3>
								<div>
									<select class="selectr selectr_380" name="company.company_develop" id="company.company_develop">
										<option value="0"><span>未融资</span></option>
										<option value="1"><span>天使轮</span></option>
										<option value="2"><span>A轮</span></option>
										<option value="3"><span>B轮</span></option>
										<option value="4"><span>C轮</span></option>
										<option value="5"><span>D轮以上</span></option>
										<option value="6"><span>上市公司</span></option>
									</select>
								</div>

								<h3>一句话简介</h3>
								<input type="text" placeholder="一句话概括公司亮点，如公司愿景、领导团队等，限50字" maxlength="50" name="company.company_brief" id="company.company_brief">
								<span style="display:none;" class="error" id="beError"></span>
								
								<h3>公司详细介绍</h3> 
		                        <textarea placeholder="请分段详细描述公司简介、企业文化等" name="companyDetail.detail_content" id="companyDetail.detail_content"></textarea>	
		                        
								
								
								<h3>产品海报（点击下方图标上传）</h3>
		                        <div class="c_logo c_logo_pos">
									<img width="190" height="190" alt="产品海报" class="img-thumbnail" name="show_product_image" id="show_product_image" width="50px"
										src="${rc.contextPath}/img/product_default.png"/>
									<input type="hidden" name="product.product_image" id="product_image"/>
									<input type="file" class="form-control" id="product_image_upload" name="product_image_upload"
										onchange="ajaxfileuploadProductImage()">
								</div>
			                   	
			                    
		                        <h3>产品名称</h3>
		                        <input type="text" placeholder="请输入产品名称" name="product.product_name" id="product.product_name">	
		                        
		                        <h3>产品链接</h3>
		                        <input type="text" placeholder="请输入产品主页URL或产品下载地址" name="product.product_url" id="product.product_url">	
		                        
		                        <h3>产品简介</h3> 
		                        <textarea placeholder="请简短描述该产品定位、产品特色、用户群体等" maxlength="1000" name="product.product_brief" id="product.product_brief"></textarea>	
								
								<input type="submit" value="完成" id="stepBtn" class="btn_big fr">
							</form>
						</dd>
					</dl>
				</div>
				<!-------------------------------------弹窗lightbox  ----------------------------------------->
				
				<!------------------------------------- end ----------------------------------------->

				<div class="clear"></div>
				<a rel="nofollow" title="回到顶部" id="backtop" style="display: none;"></a>
			</div>
			<!-- end #container -->
		</div>
		<!-- end #body -->

		<script src="${rc.contextPath}/js/core.min.js" type="text/javascript"></script>
		
		<script type="text/javascript">
		
		
		$(function() {
			
			
			//验证表单
			$("#addcompanyForm").validate({
				rules: {
					"company.company_name": {
						required: true,
					},
					"company.company_address": {
						required: true
					},
					"company.company_brief": {
						required: true
					},
					"company.company_logo": {
						required: true
					},
					"companyDetail.detail_content": {
						required: true
					},
					"product.product_name": {
						required: true
					},
					"product.product_brief": {
						required: true
					}
				},
				messages: {
					"company.company_name": {
						required: "请输入公司名称"
					},
					"company.company_address": {
						required: "请输入公司具体地址"
					},
					"company.company_brief": {
						required: "请输入公司简介"
					},
					"companyDetail.detail_content": {
						required: "请输入公司详情"
					},
					"product.product_name": {
						required: "请输入产品名称，如没有，请输入无"
					},
					"product.product_brief": {
						required: "请输入产品简介"
					}
					
				},
				submitHandler: function(form) {


					$(form).find(":submit").attr("disabled", true);
					
					jQuery.post("${rc.contextPath}/user/enterprise/addnewcompany", $("#addcompanyForm").serialize(), function(data) {
						if(data.code == 200){
							if(confirm("提交成功，等待审核，请关注邮件")){
								window.close();
							}else{
								window.close();
							}
						}
						if(data.code == 400){
							window.location.href = "${rc.contextPath}/login";
						}
						if(data.code==500){
							alert("提交失败");
						}
					}, 'json');
					
				} 
			});
		});
		
		function ajaxfileuploadCompanyLogo(){
			jQuery.ajaxFileUpload(
				{
					type:'post',
					url:"${rc.contextPath}/admin/uploadImage/0",
					secureuri:false,
					fileElementId:"company_logo_upload",
					/* dataType:"json", */
					success:function(data,status){
						var str = $(data).find("body").text();
						var json = jQuery.parseJSON(str);
						if(json.code==800){
							
							$("#company_logo").val(json.info);
							$("#show_company_logo").attr("src","http://127.0.0.1:8080/image/companylogo/"+json.info);  
						}else{
							alert(json.code+json.info);
						}
						//alert(data.info);
					},
					error:function(data,status,e){
						alert(json.code+json.info);
					}
				}					
			)
		}
		function ajaxfileuploadProductImage(){
			jQuery.ajaxFileUpload(
				{
					url:"${rc.contextPath}/admin/uploadImage/1",
					secureuri:false,
					fileElementId:"product_image_upload",
					/* dataType:"json", */
					success:function(data,status){
						var str = $(data).find("body").text();
						var json = jQuery.parseJSON(str);
						if(json.code==800){
							
							$("#product_image").val(json.info);
							$("#show_product_image").attr("src","http://127.0.0.1:8080/image/productimage/"+json.info);  
						}else{
							alert(json.code+json.info);
						}
						//alert(data.info);
					},
					error:function(data,status,e){
						alert(json.code+json.info);
					}
				}					
			)
		}
		
		</script>
		
	</body>

</html>